<?php
/**
 * [商网通 System] Copyright swtshop.cn
 * QQ: 1170787711
 * Author: gj.name
 * This is NOT a freeware
*/
defined('IN_UQ') or exit('Access Denied');
class tool_uqcms extends control
{
    function __construct()
    {
        $this->aid = $_SESSION['admin']['aid'];
        parent::__construct();
    }
    function index()
    {
        echo '<a href="?m=tool&a=local_to_aliyun">本地 -> 阿里云</a>';
    }
    function local_to_aliyun()
    {
        set_time_limit(0);
        $page = @$_GET['page'] ? $_GET['page'] : '1';
        $pageSize = @$_GET['page_size'] ? $_GET['page_size'] : '10';
        $query = $this->db->query("select * from " . table('album') . " order by id asc limit " . ($page - 1) * $pageSize . "," . $pageSize);
        while ($row = $this->db->fetch_array($query)) {
            if ($row['up'] == '0') {
                if (file_exists($row['url'])) {
                    echo $row['url'] . '|' . $row['id'];
                    echo '<br>';
                    $result_data = $this->module('album')->upload_move($row['url'], '', '', $row['url']);
                }
            }
        }
        $zshu = db()->get_one("select count(id) as total from " . table('album'));
        $zongshu = floor($zshu['total'] / $pageSize);
        $zongshu = $zongshu + 1;
        if ($zongshu >= $page) {
            $nextPage = $page + 1;
            echo '<script>location.href="?m=tool&a=local_to_aliyun&page=' . $nextPage . '"</script>';
        } else {
            echo '执行结束';
        }
    }
    function aliyun_to_qcloud()
    {
    }
    function qcloud_to_aliyun()
    {
    }
}